//hooks 复用函数

import { reactive, toRefs } from "vue"
type stateData ={
    count:number
}
function useCount(){
    let state=reactive<stateData>({
        count:0,
    })
    function add(){
        state.count++
    }

    function reduce(){
        state.count--
    }
    return {
        ...toRefs(state),add,reduce
    }
}

export default useCount